import {cateList} from '../../../util/request/api'
//封装菜单管理的状态管理
const state = {
    //菜单列表
    catelist:[],
}

const getters ={
    getCateList(state){
        return state.catelist
    },
}

const mutations = {
    REQ_CATELIST(state,payload){
        state.catelist = payload
    },
}

const actions ={
    //封装一个行动用于修改菜单列表
    getCateAction({commit}){
        cateList()
        .then(res=>{
            if(res.code==200){
                commit('REQ_CATELIST',res.list)
            }
        })
    }
}
export default {
    state,
    getters,
    mutations,
    actions,
    namespaced:true
}